﻿Public Class Tratamiento_Objetos

    Public Sub limpiar(ByVal controles As Object)
        For Each objeto As System.Windows.Forms.Control In controles
            If TypeOf objeto Is System.Windows.Forms.TextBox Then
                objeto.Text = ""
            End If
            If TypeOf objeto Is ComboBox Then
                Dim actual As ComboBox = objeto
                actual.SelectedIndex = -1
            End If
            If TypeOf objeto Is MaskedTextBox Then
                objeto.Text = ""
            End If
        Next
    End Sub


    Public Sub habilitar(ByVal value As Boolean, ByVal controles As Object)
        For Each objeto As System.Windows.Forms.Control In controles
            If TypeOf objeto Is System.Windows.Forms.TextBox Then
                objeto.Enabled = value
            End If
            If TypeOf objeto Is ComboBox Then
                objeto.Enabled = value
            End If
            If TypeOf objeto Is MaskedTextBox Then
                objeto.Enabled = value
            End If
        Next
    End Sub


    Public Sub labels_Color(ByVal color As Color, ByVal controles As Object)
        For Each objeto As System.Windows.Forms.Control In controles
            If TypeOf objeto Is System.Windows.Forms.Label Then
                objeto.ForeColor = color
            End If
        Next
    End Sub

End Class
